/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * Copyright (C) 1998-2002 Tor Lillqvist
+ * Copyright (C) 1998-2004 Tor Lillqvist
+ * Copyright (C) 2001-2004 Hans Breuer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
{
GdkWindowObject *private;
HWND old_active_window;
-
+ gboolean focus_on_map = TRUE;
+
private = (GdkWindowObject *) window;
if (private->destroyed)
/* Other cases */
if (!GDK_WINDOW_IS_MAPPED (window))
- gdk_synthesize_window_state (window,
- GDK_WINDOW_STATE_WITHDRAWN,
- 0);
+ {
+ gdk_synthesize_window_state (window,
+ GDK_WINDOW_STATE_WITHDRAWN,
+ 0);
+ focus_on_map = private->focus_on_map;
+ }
/* Use SetWindowPos to show transparent windows so automatic redraws
* in other windows can be suppressed.
UINT flags = SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOMOVE | SWP_NOSIZE;
if (!raise)
flags |= SWP_NOZORDER;
- if (!raise || GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP)
+ if (!raise || GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP || !focus_on_map)
flags |= SWP_NOACTIVATE;
SetWindowPos (GDK_WINDOW_HWND (window), HWND_TOP, 0, 0, 0, 0, flags);
ShowWindow (GDK_WINDOW_HWND (window), SW_MAXIMIZE);
else if (private->state & GDK_WINDOW_STATE_ICONIFIED)
ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
- else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP)
+ else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP || !focus_on_map)
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNOACTIVATE);
else
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
gtk_action_group_set_translate_func
gtk_action_group_set_translation_domain
gtk_action_group_set_visible
+ gtk_action_group_translate_string
gtk_action_is_sensitive
gtk_action_is_visible
gtk_action_new
gtk_combo_box_entry_set_text_column
gtk_combo_box_get_active
gtk_combo_box_get_active_iter
+ gtk_combo_box_get_column_span_column
gtk_combo_box_get_model
+ gtk_combo_box_get_row_span_column
gtk_combo_box_get_type
+ gtk_combo_box_get_wrap_width
gtk_combo_box_insert_text
gtk_combo_box_new
gtk_combo_box_new_text
gtk_window_get_default_size
gtk_window_get_destroy_with_parent
gtk_window_get_focus
+ gtk_window_get_focus_on_map
gtk_window_get_frame_dimensions
gtk_window_get_gravity
gtk_window_get_has_frame
gtk_window_set_default_size
gtk_window_set_destroy_with_parent
gtk_window_set_focus
+ gtk_window_set_focus_on_map
gtk_window_set_frame_dimensions
gtk_window_set_geometry_hints
gtk_window_set_gravity
/* GTK - The GIMP Toolkit
* gtkfilesystemwin32.c: Default implementation of GtkFileSystem for Windows
* Copyright (C) 2003, Red Hat, Inc.
+ * Copyright (C) 2004, Hans Breuer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
GdkPixbuf *pixbuf = NULL;
WORD iicon;
HICON hicon;
+ char filename_copy[MAX_PATH];
if (!filename || !filename[0])
return NULL;
- hicon = ExtractAssociatedIcon (GetModuleHandle (NULL), filename, &iicon);
+ /* the ugly ExtractAssociatedIcon modifies filename in place - at least on win98 */
+ strcpy(filename_copy, filename);
+ hicon = ExtractAssociatedIcon (GetModuleHandle (NULL), filename_copy, &iicon);
if (hicon > (HICON)1)
{
ICONINFO ii;
if (GetIconInfo (hicon, &ii))
{
- SIZE size;
- GdkPixmap *pixmap;
- GdkGC *gc;
- HDC hdc;
-
- if (!GetBitmapDimensionEx (ii.hbmColor, &size))
- g_warning ("GetBitmapDimensionEx failed.");
-
- if (size.cx < 1) size.cx = 32;
- if (size.cy < 1) size.cy = 32;
-
- pixmap = gdk_pixmap_new (NULL, size.cx, size.cy,
- gdk_screen_get_system_visual (gdk_screen_get_default ())->depth);
- gc = gdk_gc_new (pixmap);
- hdc = gdk_win32_hdc_get (GDK_DRAWABLE (pixmap), gc, 0);
-
- if (!DrawIcon (hdc, 0, 0, hicon))
- g_warning ("DrawIcon failed");
-
- gdk_win32_hdc_release (GDK_DRAWABLE (pixmap), gc, 0);
-
- pixbuf = gdk_pixbuf_get_from_drawable (
- NULL, pixmap,
- gdk_screen_get_system_colormap (gdk_screen_get_default ()),
- 0, 0, 0, 0, size.cx, size.cy);
- g_object_unref (pixmap);
- g_object_unref (gc);
+ struct
+ {
+ BITMAPINFOHEADER bi;
+ RGBQUAD colors[2];
+ } bmi;
+ HDC hdc;
+
+ memset (&bmi, 0, sizeof (bmi));
+ bmi.bi.biSize = sizeof (bmi.bi);
+ hdc = CreateCompatibleDC (NULL);
+
+ if (GetDIBits (hdc, ii.hbmColor, 0, 1, NULL, (BITMAPINFO *)&bmi, DIB_RGB_COLORS))
+ {
+ gchar *pixels, *bits;
+ gint rowstride, x, y, w = bmi.bi.biWidth, h = bmi.bi.biHeight;
+
+ bmi.bi.biBitCount = 24;
+ bmi.bi.biCompression = BI_RGB;
+ bmi.bi.biHeight = -h;
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, w, h);
+ bits = g_malloc (4 * w * h);
+
+ /* color data */
+ if (!GetDIBits (hdc, ii.hbmColor, 0, h, bits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS))
+ g_warning(G_STRLOC ": Failed to get dibits");
+
+ pixels = gdk_pixbuf_get_pixels (pixbuf);
+ rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+ for (y = 0; y < h; y++)
+ {
+ for (x = 0; x < w; x++)
+ {
+ pixels[2] = bits[(x+y*w) * 3];
+ pixels[1] = bits[(x+y*w) * 3 + 1];
+ pixels[0] = bits[(x+y*w) * 3 + 2];
+ pixels += 4;
+ }
+ pixels += (w * 4 - rowstride);
+ }
+ /* transparency */
+ if (!GetDIBits (hdc, ii.hbmMask, 0, h, bits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS))
+ g_warning(G_STRLOC ": Failed to get dibits");
+ pixels = gdk_pixbuf_get_pixels (pixbuf);
+ for (y = 0; y < h; y++)
+ {
+ for (x = 0; x < w; x++)
+ {
+ pixels[3] = 255 - bits[(x + y * w) * 3];
+ pixels += 4;
+ }
+ pixels += (w * 4 - rowstride);
+ }
+
+ /* release temporary resources */
+ g_free (bits);
+ if (!DeleteObject (ii.hbmColor) || !DeleteObject (ii.hbmMask))
+ g_warning(G_STRLOC ": Leaking Icon Bitmaps ?");
+ }
+ else
+ g_warning(G_STRLOC ": GetDIBits () failed, %s", g_win32_error_message (GetLastError ()));
+
+ DeleteDC (hdc);
}
else
- g_print ("GetIconInfo failed: %s\n", g_win32_error_message (GetLastError ()));
+ g_warning(G_STRLOC ": GetIconInfo failed: %s\n", g_win32_error_message (GetLastError ()));
if (!DestroyIcon (hicon))
- g_warning ("DestroyIcon failed");
+ g_warning(G_STRLOC ": DestroyIcon failed");
}
else
- g_print ("ExtractAssociatedIcon failed: %s\n", g_win32_error_message (GetLastError ()));
+ g_print ("ExtractAssociatedIcon(%s) failed: %s\n", filename, g_win32_error_message (GetLastError ()));
return pixbuf;
}
case DRIVE_CDROM :
icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_CDROM);
break;
- case DRIVE_FIXED : /* need a hard disk icon */
+ case DRIVE_FIXED :
icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_HARDDISK);
break;
default :